//
//  RW_FuncItemCollectionViewCell.m
//  SleepApp
//
//  Created by chuangqi on 2021/3/30.
//  Copyright © 2021 RiceWang. All rights reserved.
//

#import "RW_FuncItemCollectionViewCell.h"
#import "RW_PushPlayersTools.h"


@interface RW_FuncItemCollectionViewCell ()
/** 名称 */
@property (nonatomic,strong) UILabel *wlclass_title_label;
/** 选中icon 在添加歌单歌曲关系处有用 */
@property (nonatomic,strong) UIImageView *wlclass_select_image;
@end
@implementation RW_FuncItemCollectionViewCell

-(void)bind_row_data:(WLBaseCollectionViewLayerRow *)sender{
    if ([sender.data isKindOfClass:RW_FuncItemCollectionViewCellModel.class]){
        RW_FuncItemCollectionViewCellModel *model = sender.data;
        
        self.wlclass_title_label.text = model.title_string;
        
        self.wlclass_select_image.hidden = model.players_Type != [RW_PushPlayersTools getPlayersType];
    }
}
-(void)bind_delegate:(id)sender{
    
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = UIColor.whiteColor;

        [self addSubview:self.wlclass_title_label];
        [self addSubview:self.wlclass_select_image];

        [self.wlclass_title_label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.mas_equalTo(self);
            make.left.mas_equalTo(self).mas_offset(15);
            make.right.mas_equalTo(self).mas_offset(-50);
        }];
        [self.wlclass_select_image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self);
            make.right.mas_equalTo(self).mas_offset(-5);
            make.size.mas_equalTo(CGSizeMake(30, 30));
        }];
    }
    return self;
}
#pragma mark -- 代理

#pragma mark -- 懒加载
-(UILabel *)wlclass_title_label{
    if (!_wlclass_title_label){
        _wlclass_title_label = [[UILabel alloc]init];
    }
    return _wlclass_title_label;
}
-(UIImageView *)wlclass_select_image{
    if (!_wlclass_select_image){
        _wlclass_select_image = [[UIImageView alloc]initWithImage:[UIImage svgName:@"select_icon"]];
        _wlclass_select_image.hidden = YES;
    }
    return _wlclass_select_image;
}
@end

@implementation RW_FuncItemCollectionViewCellModel

@end
